// call 实现
Function.prototype.myApply = function(context) {
  if (typeof context == null) {
    context = window
  } 
  context.fn = this
  // 获取传入的参数 => 1, 2
  console.log(arguments)
  const args = arguments[1]
  let result
  if (args) {
    result = context.fn(...args)
  } else {
    result = context.fn()
  }
  delete context.fn
  return result
}

function fn1() {
  console.log('this', this)
  const obj = {
    name: 'wpw',
    age: 18
  }
}
// fn1.apply({name: 'bb'})
fn1.myApply({name: 'bb'})